package zj.it.bhne.gridengineeringsurvey.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import zj.it.bhne.gridengineeringsurvey.BaseActivity;
import zj.it.bhne.gridengineeringsurvey.R;

public class AccountActivity extends BaseActivity implements View.OnClickListener {

    private Context context;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_account);
        context = this;
        initView();
    }

    private void initView() {
        ImageButton activity_ib_back = findViewById(R.id.activity_ib_back);
        TextView activity_tv_title = findViewById(R.id.activity_tv_title);
        TextView activity_tv_save = findViewById(R.id.activity_tv_save);
        activity_tv_title.setText("账号管理");
        activity_tv_save.setText("");
        activity_ib_back.setOnClickListener(this);
        RelativeLayout account_btn_zhu = findViewById(R.id.account_btn_zhu);
        account_btn_zhu.setOnClickListener(this);
        RelativeLayout account_btn_update = findViewById(R.id.account_btn_update);
        account_btn_update.setOnClickListener(this);
        RelativeLayout account_btn_forget = findViewById(R.id.account_btn_forget);
        account_btn_forget.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.activity_ib_back:
                getIntents();
                break;
            case R.id.account_btn_zhu:
                setIntents(LoginActivity.class);
                break;
            case R.id.account_btn_update:
                setIntents(UpdateActivity.class);
                break;
            case R.id.account_btn_forget:
                setIntents(ForgetPassActivity.class);
                break;
        }
    }

    /**
     * 跳转到主界面
     */
    private void getIntents() {
        Intent intent = new Intent(context, BottomActivity.class);
        intent.putExtra("item_id", 3);
        startActivity(intent);
        finish();
    }

    private void setIntents(Class<?> cls){
        Intent intent = new Intent(context, cls);
        intent.putExtra("number", 2);
        startActivity(intent);
        finish();
    }

}
